//
// Created by denglibin on 19-10-5.
//

/**
 * #include<dirent.h>
 * DIR * opendir(const char * name);
 * 根据传入的目录名打开一个目录,成功返回指向该目录结构体指针，失败返回NULL
 * */
#include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
static int main_(void){

    char * dirName = "/home/denglibin/books";
    DIR * dir = opendir(dirName);
    if(dir == NULL){
        perror("opendir error:");
        return -1;
    }
    closedir(dir); // 关闭
    return 0;

}